package com.example.zhu.service.Impl;

import com.example.zhu.entity.Coupon;
import com.example.zhu.mapper.CouponMapper;
import com.example.zhu.service.CouponService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CouponServiceImpl implements CouponService {

    @Autowired
    private CouponMapper couponMapper;

    /**
     * 根据优惠券姓名查询
     * @param name
     * @return
     */
    public List<Coupon> selectByName(String name) {
        List<Coupon> list = couponMapper.selectByName(name);
        return list;
    }

    /**
     * 查询全部优惠券
     * @return
     */
    public List<Coupon> selectAll() {
        List<Coupon> list = couponMapper.selectAll();
        return list;
    }

    @Override
    public List<Coupon> selectById(Integer id) {
        List<Coupon> couponList =couponMapper.selectById(id);
        return couponList;
    }
}
